<!doctype html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport"
          content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>首页</title>
    <link rel="stylesheet" href="layui/css/layui.css">
    <link rel="stylesheet" href="iconfont/iconfont.css">
    <link rel="stylesheet" href="css/base.css">
</head>
<body class="layui-layout-body">
<div class="layui-layout layui-layout-admin">
    <div class="layui-header">
        <div class="layui-logo" style="width: 200px;color: #fff"><img src="img/logo.png" alt="" style="height: 50%;margin-right: 10px;"></div>
        <ul class="layui-nav layui-layout-left">
            <li class="layui-nav-item cur" onclick="reloadIframe()">&emsp;刷新&emsp;</li>
        </ul>
        <ul class="layui-nav layui-layout-right">
            <li class="layui-nav-item">
                <a href="javascript:;">
                    <img src="http://t.cn/RCzsdCq" class="layui-nav-img">
                </a>
            </li>
            <li class="layui-nav-item"><a href="login.html">退出</a></li>
        </ul>
    </div>

    <div class="layui-side layui-bg-black">
        <div class="layui-side-scroll">
            <!-- 左侧导航区域（可配合layui已有的垂直导航） -->
            <ul class="layui-nav layui-nav-tree">
                <li class="layui-nav-item"><a href="#view/kehu/index.html"><span>客户管理</span></a></li>
                <li class="layui-nav-item"><a href="#view/zhandian/index.html"><span>站点管理</span></a></li>
                <li class="layui-nav-item"><a href="#view/yuangong/index.html"><span>员工管理</span></a></li>
                <li class="layui-nav-item"><a href="#view/gonggao/index.html"><span>公告管理</span></a></li>
                <li class="layui-nav-item"><a href="#view/yuyue/index.html"> <span>预约提醒管理</span></a></li>
                <li class="layui-nav-item"><a href="#view/admin/index.html"><span>管理员管理</span></a></li>
            </ul>
        </div>
    </div>

    <div class="layui-body">
        <!-- 内容主体区域 -->
        <iframe src="#view/kehu/index.html" frameborder="0" id="main"></iframe>
    </div>
</div>

<script src="layui/layui.js"></script>
<script>
    var reloadIframe;
    layui.use(['element','jquery','layer'], function(){
        var element = layui.element;
        var $ = layui.jquery;
        var layer = layui.layer;
        //iframe加载
        var u = window.location.href.split('#')[1];
        $('#main').attr('src',u);
        $('.layui-nav a[href="#'+ $('#main').attr('src') + '"]').parents().addClass('layui-this');
        $('.layui-nav a').on('click',function () {
            var url = $(this).attr('href').substring(1);
            $('#main').attr('src',url);
        });
        reloadIframe = function () {
            layer.msg('刷新成功',{
                time: 1000,
                offset:'10px'
            });
            document.getElementById('main').contentWindow.location.reload(true);
        };
    });
    document.onkeydown = function (e) {
        if(e.keyCode==116) {
            reloadIframe();
            return false;
        }
    }
</script>
</body>
</html>